
public class 輸出效能研究 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int i;
		long begin,elapsed1,elapsed2;
		String s = "test string";
		
		begin = System.currentTimeMillis();
		for(i=0;i<10000;i++) {
			System.out.printf("This is %s\n",s);
		}
		elapsed1 = System.currentTimeMillis() - begin;
		
		
		begin = System.currentTimeMillis();
		for(i=0;i<10000;i++) {
			System.out.print("This is ");
			System.out.println(s);
		}
		elapsed2 = System.currentTimeMillis() - begin;
		System.out.println("printf 耗費 "+elapsed1+"ms");
		System.out.println("print 耗費 "+elapsed2+"ms");
	}

}
